package com.esd.crm.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.esd.crm.entity.AreaCode;
import com.esd.crm.service.AreaCodeService;
@Controller
@RequestMapping("/public")
public class PublicController {
	
	private static Logger logger = Logger.getLogger(PublicController.class);
	
	@Autowired
	private AreaCodeService areaCodeService;
	
	// 现居住地--地区联动控件数据接口
	@RequestMapping(value = "/areaCode", method = RequestMethod.GET)
	@ResponseBody
	public Map<String, Object> areaAddress_get(@RequestParam(value = "areaCode", required = false) String areaKey,
			HttpServletRequest request) {
		logger.info("*********   现居住地 地区联动控件数据接口   *********");
		Map<String, Object> entity = new HashMap<>();
		List<AreaCode> AreaCodeList = areaCodeService.getSubAreaAddress(areaKey);
		entity.put("areaCodeList", AreaCodeList);
		return entity;
	}
}
